﻿@namespace MudBlazor
@using MudBlazor.Resources
@inherits MudComponentBase
@inject InternalMudLocalizer Localizer

@{
#nullable enable
}

<div @attributes="UserAttributes" id="@_elementId" class="mud-dialog-container @GetPosition()">
    <MudOverlay Visible="true" OnClick="HandleBackgroundClickAsync" Class="@BackgroundClassname" DarkBackground="true" @onmouseup="OnMouseUp" />
    <div @ref="_dialogContainerReference" id="_@Id.ToString("N")" role="dialog" class="@Classname" style="@Style" tabindex="-1">
        @if (!GetHideHeader())
        {
            <div class="@TitleClassname">
                @if (TitleContent is null)
                {
                    <MudText Typo="Typo.h6">@_titleState.Value</MudText>
                }
                else
                {
                    @TitleContent
                }
                @if (GetCloseButton())
                {
                    <MudIconButton aria-label="@Localizer[LanguageResource.MudDialog_Close]" Icon="@CloseIcon" @onclick="((IMudDialogInstance)this).Cancel" Class="mud-button-close" />
                }
            </div>
         }
        <CascadingValue Value="(IMudDialogInstanceInternal)this" IsFixed="true">
            @Content
        </CascadingValue>
    </div>
</div>
